@isTest
private class CreditchangeControllerTest {

    static testMethod void testMethod1() {
        
         // 客户
        Account acc = new Account();
        acc.Name = 'test customer';
        acc.Status__c = '审核通过';
        acc.Level__c = '一级医院';
        acc.RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('Dealer', 'Account');
        insert acc;

        User u =[select SubCompany__c from User where Id =:UserInfo.getUserId() ];

        AccountCredit__c ac = new AccountCredit__c();
        ac.Account__c = acc.Id;
        ac.NCCreditDeadline__c = '0';
        ac.CreditLimit__c =100;
        ac.Company__c = u.SubCompany__c;
        insert ac;

        PageReference page2 = new PageReference('/apex/Creditchange?id='+acc.Id );
        System.Test.setCurrentPage(page2);
        CreditchangeController aic = new CreditchangeController();
        aic.init();



        Map<String,String> saveMap = new Map<String,String>();
        saveMap.put('Account__c', acc.Id);
        saveMap.put('Company__c', u.SubCompany__c);

        aic.saveJson = EncodingUtil.urlEncode(JSON.serialize(saveMap), 'UTF-8');

        aic.save();


    }


}